package com.example.demo.vo;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;

@Data
public class HelloDto {
    private String name;
    @JSONField(serialize = false)
    private String name2;
    private Integer age;
    @JSONField(serialize = false)
    private boolean boo;

    public void setName2(String name2) {
        this.name2 = name2;
        this.name = name2;
    }

    public static void main(String[] args) {
        String json = "{\"name2\":\"name2\"}";
        HelloDto dto = JSONObject.parseObject(json, HelloDto.class);
        System.out.println(JSON.toJSONString(dto));
    }
}
